package lab2.text17;

/**
 * Created by Administrator on 2017/10/26.
 */
public class Text {
    public static void main(String[] args) {

//ctrl+d复制
        //cyrl+x删除
        int[] numbers = new int[5];
        numbers[0] = 12;
        numbers[1] = 21;
        numbers[2] = 15;
        numbers[3] = 18;
        numbers[4] = 19;
       //打印数组所有元素
       // System.out.println(numbers[0]);
      //  System.out.println(numbers[1]);
       // System.out.println(numbers[2]);
       // System.out.println(numbers[3]);
       // System.out.println(numbers[4]);
        int index;
        for(index=0;index<numbers.length;index++) {
            System.out.println(numbers[index]);
        }
            int i,j,p;
            int sum=0,max,min,temp;
            for(i=0;i<5;i++) {
                sum += numbers[i];}
                max=numbers[0];
            for(j=1;j<5;j++) {
                if(max<numbers[j]){
                    max=numbers[j];
                    }
                }
                min=numbers[0];
            for(p=1;p<numbers.length-1-i;p++) {
                if(min>numbers[p]){
                min=numbers[p];
            }
        }
        System.out.println("总和是："+sum);
        System.out.println("最大值："+max);
        System.out.println("最大值在："+j);
        System.out.println("最小值："+min);
        System.out.println("最小值在："+p);
    }
}
//shift+F6、refactor-rename改包名或类名